package com.zr.inquiry.mapper;



import com.zr.inquiry.pojo.*;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import javax.validation.Valid;
import java.util.List;


/**
 * Created by 陈紫陌 on 2019-10-09.
 */
@Mapper
public interface InquiryMapper {

    public void addInquiryTotal(InquiryTotal inquiryTotal);

    void addInquirySparePartDetail(List<InquirySpareDetail> inquirySpareDetailList);

    void addInquirySupplirDetail(List<InquirySupplirDetail> inquirySupplirDetailList);

    LegalPersonVo queryLegalPersionById (Integer legalPersonId);

    List<String> querySparePartByList(List<String> codeList);

    List<SpareSupplier> querySpareSupplierByCodeList(List<String> codeList);
    @Select("select * from inquirytotal where id = #{id}")
    InquiryTotal queryById(Integer id);
    @Select("select * from inquirysparedetail where inquiryId = #{inquiryId} ")
    List<InquirySpareDetail> querySparePartByTotalId(Integer totalid);
    @Select("select * from inquirysupplierdetail where inquiryId = #{inquiryId} ")
    List<InquirySupplirDetail> querySupplirByTotalId(Integer totalid);

    void updateInquiryTotal(InquiryTotal inquiryTotal);
    @Delete("delete from inquirysparedetail where inquiry=#{inquiryId}")
    void deleteSparePartByTotalId(Integer id);
    @Delete("delete from inquirysupplierdetail where inquiry=#{inquiryId}")
    void deleteSupplierByTotalId(Integer id);

    List<InquiryTotal> queryPage(@Valid InquirySelectVo inquirySelectVo);

    int queryCount(@Valid InquirySelectVo inquirySelectVo);
}
